/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package com.money.dao.impl;

import com.money.dao.AdministratorDao;
import com.money.entity.Administrator;
import com.money.mapper.AdministratorMapper;
import javax.annotation.Resource;
import org.springframework.stereotype.Repository;

/**
 *
 * @author Eason
 */
@SuppressWarnings("unchecked")
@Repository("adminDao")
public class AdministratorDaoImpl implements AdministratorDao{
    @Resource(name="adminMapper")
    private AdministratorMapper mapper;

    @Override
    public Administrator getAdministrator() {
        return mapper.getAdministrator();
    }

    @Override
    public boolean validate(Administrator admin) {
        Administrator real = getAdministrator();
        if(!(real.getUsername().equals(admin.getUsername())&&(real.getPassword().equals(admin.getPassword())))){
            return false;
        }else{
            return true;
        }
    }
    
    
}
